import requests

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
}
url = 'https://xueqiu.com/'
# 获取访问首页时响应的cookie
res = requests.get(url, headers=headers)
cookies = requests.utils.dict_from_cookiejar(res.cookies)
# print(dict(res.cookies))
# print(cookies)
url = 'https://xueqiu.com/statuses/hot/listV2.json?since_id=-1&max_id=596226&size=15'
# 手动携带cookie进行访问
res = requests.get(url, headers=headers, cookies=cookies)
print(res.content.decode())
